package com.fis.mca.client;

import java.net.MalformedURLException;
import java.net.URL;

import javax.xml.namespace.QName;

import com.fis.mca.config.Config;
import com.fis.mca.config.ConfigConstant;
import com.fis.mca.service.ServiceTransferer;
import com.fis.mca.service.ServiceTransfererService;

public class ServiceTransfererClient
{
	private static final QName SERVICE_NAME = new QName(
			"http://service.mca.fis.com/", "ServiceTransfererService");
	private static final String WSDL_URL = Config
			.getURL(ConfigConstant.SERVICE_PORT_KEY);
	
	private static final ServiceTransferer port;
	private static final ServiceTransfererService ss;
	
	private ServiceTransfererClient()
	{
	}
	
	static
	{
		URL url = null;
		try
		{
			url = new URL(WSDL_URL);
		}
		catch (MalformedURLException e)
		{
			java.util.logging.Logger.getLogger(
					ServiceTransfererClient.class.getName()).log(
					java.util.logging.Level.INFO,
					"Can not initialize the default wsdl from {0}", WSDL_URL);
		}
		
		ss = new ServiceTransfererService(url, SERVICE_NAME);
		port = ss.getServiceTransfererPort();
	}
	
	public static ServiceTransferer getService()
	{
		return port;
	}
}
